In   -
Out  test
Type AOFModule
Ver  1.00s

Define Module
 Name      test
 Author    Justin Fletcher
 Init      init
End Module

Pre
 |MySym|=5
End Pre

.init
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   XBL     |history_create|,0            ; create a history 0 long
   MOV     v1,r0                         ; v1-> history
   LADR    a2,$`string1                  ; 1st
   XBL     |history_add|,v1              ; add first string
   LADR    a2,$`string2                  ; 2nd
   XBL     |history_add|,v1              ; add second string
   LADR    a2,$`string3                  ; 3rd
   XBL     |history_add|,v1              ; add third string
   MOV     v2,#0                         ; the entry to go from
$loop
   XBL     |history_previous|,v1,v2      ; hist,entry
   CMP     r0,#0                         ; is it 0 ?
   BEQ     $done                         ; if so, we're done
   REM     "Read back %$0"
   MOV     v2,r0                         ; last = this
   B       $loop                         ; go around again
$done
   XBL     |history_destroy|,v1          ; get rid of it
   LDR     r0,$symval                    ; get the value stored
   REM     "My Symbol = %&0 (read a line)"
   LADR    r0,$`string1
   XBL     |gets|                        ; read a string
   REM     "Read %$0"
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call

$symval
   EQUD    |MySym|

$`string1
   EQUZ    "string 1"
$`string2
   EQUZ    "string 2"
$`string3
   EQUZ    "string 3"
